package stardust.product.utils.transmit;

public class TransmitMain
{
  
  public static void main(String[] args)
  {
    if (args != null && args.length > 0)
    {
      TransmitMain._main(args);
    }
    else
    {
      TransmitMain._main(args);
//      TransmitMain._main(new String[] {"12345", null, "-1", null, "-1", "HTTP"});
//      TransmitMain._main(new String[] {"12345", "scitel123.vicp.cc", "80", null, "-1", "SOCKET"});
      
//      TransmitMain._main(new String[] {"30046", "130.51.79.46", "1521", "10.210.6.144", "50021", "AUTO_HTTP"});
//      TransmitMain._main(new String[] {"30068", "130.51.79.68", "3389", "10.210.6.144", "50021", "AUTO_HTTP"});
//      TransmitMain._main(new String[] {"30078", "130.51.79.78", "3389", "10.210.6.144", "50021", "AUTO_HTTP"});
    }
  }
  
  public static void _main(String[] args)
  {
    if (args == null || args.length != 6)
    {
      System.err.println("ARGUMENT ERROR:");
      System.err.println("java -jar Transmit.jar LOCAL_PORT REMOTE_HOST REMOTE_PORT PROXY_HOST PROXY_PORT (SOCKET|HTTP|AUTO_HTTP)");
//      System.err.println("java -jar Transmit.jar 本机监听端口 [目标主机地址] [目标主机端口] [HTTP隧道主机地址] [HTTP隧道主机端口] (SOCKET[套接字转发]|HTTP[HTTP隧道代理]|AUTO_HTTP[基于HTTP隧道代理的套接字转发])");
      
//      args = new String[] {"12345", null, "-1", "HTTP"};
//      args = new String[] {"12345", "10.210.6.244", "1521", "SOCKET"};
      //args = new String[] {"30068", "130.51.79.68", "3389", "10.210.6.144", "50021", "AUTO_HTTP"};
      return;
    }
    
    int localPort = Integer.parseInt(args[0]);
    String remoteHost = args[1];
    int remotePort = Integer.parseInt(args[2]);
    String proxyHost = args[3];
    int proxyPort = Integer.parseInt(args[4]);
    String type = args[5];
    
    new TransmitListener(localPort, remoteHost, remotePort, proxyHost, proxyPort, type).start();
  }
  
}
